<?php
JTable::addIncludePath ( JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_a' . DS . 'tables' );
$call = isset ( $_GET ['mode'] ) ? $_GET ['mode'] : '';

switch ( $call) {
	case 'add' :
		add ();
	break;
	case 'edit' :
		add ();
	break;
	default :
		show ();
	break;
}

function add() {
	$row = & JTable::getInstance ( 'a', 'Table' );
	if (isset ( $_POST ['name'] )) {
		if (! $row->bind ( JRequest::get ( 'post' ) )) {
			return JError::raiseWarning ( 500, $row->getError () );
		}
		if (! $row->store ()) {
			JError::raiseError ( 500, $row->getError () );
		}
	} else {
		echo "<form method='post'><input type='text' name='name'><input type='submit'></form>";
	}
}

function edit() {

}
function show() {

}
?>